package com.firebird.app.fejpsl.adapter;

import android.view.View;
import android.widget.ImageView;

import androidx.annotation.LayoutRes;
import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.firebird.app.fejpsl.R;
import com.firebird.app.fejpsl.mvp.model.bean.Follow;
import com.firebird.app.fejpsl.utils.ImageLoader;

import java.util.List;

public class FollowAdapter extends BaseQuickAdapter<Follow, BaseViewHolder> {
    public FollowAdapter(@LayoutRes int layoutResId, @Nullable List<Follow> data){
        super(layoutResId,data);
    }
    @Override
    protected void convert(BaseViewHolder helper,Follow item){
        //可链式调用赋值
        helper.setText(R.id.tv_user_name, item.getUser_name())
                .setText(R.id.tv_content, item.getContent())
                .addOnClickListener(R.id.iv_avatar);
        String imagePath=item.getImage_path();
        /*
        if (imagePath.isEmpty()) {
            helper.getView(R.id.iv_avatar).setVisibility(View.GONE);
        } else {
            helper.getView(R.id.iv_avatar).setVisibility(View.VISIBLE);
           // Glide.with(mContext).load("http://goo.gl/gEgYUd").into(R.id.iv_avatar);
            //ImageLoader.load(mContext, item.getImage_path(), helper.getView(R.id.iv_avatar));
        }*/
       // 加载网络图片
         Glide.with(mContext).load(item.getImage_path()).into((ImageView) helper.getView(R.id.iv_avatar));

        //获取当前条目position
        //int position = helper.getLayoutPosition();
    }
}
